home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.002 / stk-3 / STk-3.1 / configure.in < prev    next >
Encoding:
Text File  |  1996-07-21  |  11.6 KB  |  524 lines

  1. dnl    This file is an input file used by the GNU "autoconf" program to
  2. dnl    generate the file "configure", which is run during STk installation
  3. dnl    to configure the system for the local environment.
  4.  
  5. AC_INIT(README)
  6.  
  7. # I have a lot of problems with cache. So ...
  8. /bin/rm -f ./config.cache Src/config.cache Tk/config.cache Tcl/config.cache
  9.  
  10. # determine the kind of the machine which is running this script
  11. os=`uname -s`
  12. version=`uname -r`
  13. machine=`uname -m`
  14.  
  15. case $os in
  16.   Linux*) 
  17.       case $version in
  18.             1.*) version=1.X;;
  19.       esac
  20.       case $machine in
  21.         i*86) machine=ix86;;
  22.       esac;;
  23.   SunOS*)
  24.       case $version in
  25.         4.1.*) version=4.1.X;;
  26.       esac
  27.       case $machine in
  28.         sun4*) machine=sun4;;
  29.       esac;;
  30.   IRIX*)
  31.       case $version in
  32.         5.*) version=5.X;;
  33.         6.*) version=6.X;;
  34.       esac
  35.       case $machine in
  36.        IP*) machine=IPxx;;
  37.       esac;;
  38.   HP-UX*)
  39.        case $version in
  40.          A.09.*) version=9.X;;
  41.          A.10.*) version=10.X;;
  42.        esac
  43.        case $machine in
  44.          9000/7*) machine=9000s700;;
  45.        esac;;
  46. esac
  47.  
  48. #
  49. # General variables:
  50. #    DFLGS= the -Dxxx options
  51. #    EDFLGS= the -Dxxx options (which could be erased if dyn. loading is enabled)
  52. #    EOBJ= Some extra '.o' to build
  53. #    ETKOBJ= Some extra '.o' to build (when used with Tk)
  54. #    MACHINE= something which identifies the machine (hard/OS/machine)
  55. DFLGS="-DSTk_CODE"
  56. EOBJ=""
  57. ETKOBJ=""
  58. EDFLGS=""
  59. MACHINE=$os-$version-$machine
  60. AC_SUBST(DFLGS, DFLGS)
  61. AC_SUBST(EOBJ, EOBJ)
  62. AC_SUBST(ETKOBJ, ETKOBJ)
  63. AC_SUBST(MACHINE,MACHINE)
  64.  
  65. ####
  66. #### Checks for various programs:
  67. ####
  68. AC_PROG_RANLIB
  69. STRIP=strip; AC_SUBST(STRIP)
  70.  
  71. ####
  72. #### Find the C compiler an compile flags
  73. ####
  74. CC=${CC-gcc}
  75. echo "Using '$CC' compiler"
  76. AC_SUBST(CC)
  77.  
  78. STKCFLAGS=${CFLAGS-"-O2"}
  79. AC_SUBST(STKCFLAGS, STKCFLAGS)
  80. echo "Using '$STKCFLAGS' compilation options"
  81.  
  82. STKLDFLAGS=""
  83. AC_SUBST(STKLDFLAGS)
  84.  
  85. ####
  86. #### Try to figure the system we have
  87. ####
  88. case $MACHINE in
  89.   SunOS-4*)  OS=SUNOS4;;
  90.   SunOS-5*)  OS=SUNOS5;;
  91.   OSF1*)     OS=OSF1;;
  92.   ULTRIX*)   OS=ULTRIX;;
  93.   HP*)         OS=HPUX; DFLGS="$DFLGS -Dhpux";;
  94.   Linux*)    OS=LINUX;;
  95.   NetBSD-1*) OS=NETBSD1;;
  96.   FreeBSD*)  OS=FREEBSD;;
  97.   IRIX-5*)   OS=IRIX5;;
  98.   *)         OS=unknown_system;;
  99. esac
  100.  
  101. # Set the OS flag soon since it can be augmented with Linux
  102. DFLGS="$DFLGS -D$OS"
  103. echo "Assumming OS is $OS"
  104.  
  105. ####
  106. #### X11 stuff
  107. ####
  108. AC_PATH_X
  109. AC_PATH_XTRA
  110.  
  111. XINCLUDES=""; AC_SUBST(XINCLUDES)
  112. XLIBSW="";    AC_SUBST(XLIBSW)
  113.  
  114. if test "$x_includes" != "" 
  115. then 
  116.   XINCLUDES=-I$x_includes
  117. fi
  118.  
  119. if test "$x_libraries" != ""
  120. then
  121.    XLIBSW="-L$x_libraries"
  122. fi
  123.  
  124. XLIBSW="$XLIBSW $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
  125.  
  126. #--------------------------------------------------------------------
  127. #    Include sys/select.h if it exists and if it supplies things
  128. #    that appear to be useful and aren't already in sys/types.h.
  129. #    This appears to be true only on the RS/6000 under AIX.  Some
  130. #    systems like OSF/1 have a sys/select.h that's of no use, and
  131. #    other systems like SCO UNIX have a sys/select.h that's
  132. #    pernicious.  If "fd_set" isn't defined anywhere then set a
  133. #    special flag.
  134. #--------------------------------------------------------------------
  135.  
  136. AC_MSG_CHECKING([fd_set and sys/select])
  137. AC_TRY_COMPILE([#include <sys/types.h>],
  138.     [fd_set readMask, writeMask;], tk_ok=yes, tk_ok=no)
  139. if test $tk_ok = no; then
  140.     AC_HEADER_EGREP(fd_mask, sys/select.h, tk_ok=yes)
  141.     if test $tk_ok = yes; then
  142.     AC_DEFINE(HAVE_SYS_SELECT_H)
  143.     fi
  144. fi
  145. AC_MSG_RESULT($tk_ok)
  146. if test $tk_ok = no; then
  147.     AC_DEFINE(NO_FD_SET)
  148. fi
  149.  
  150.  
  151. ####
  152. #### Find the MP library to use
  153. ####
  154. AC_ARG_WITH(fgmp, 
  155.     [    --with-fgmp        Use a free replacement of Gnu MP package],
  156.     MP=libfgmp, 
  157.     MP=libgmp)
  158. echo "Multiple precision library: $MP"
  159. AC_SUBST(MP, MP)
  160.  
  161. ####
  162. #### Hash tables
  163. ####
  164. AC_ARG_ENABLE(hash, 
  165.     [    --enable-hash        Enable hash table support],
  166.     hashtable="$enable_hash",
  167.     hashtable="yes")
  168.  
  169. if test "$hashtable" = "yes" ; 
  170. then
  171.   EOBJ="$EOBJ hash.o"; EDFLGS="$EDFLGS -DUSE_HASH"
  172. fi
  173.  
  174. echo "Hash tables support: $hashtable"
  175.  
  176. ####
  177. #### Posix support
  178. ####
  179. AC_ARG_ENABLE(posix, 
  180.     [    --enable-posix        Enable posix support],
  181.     posix="$enable_posix",
  182.     posix="yes")
  183.  
  184. if test "$posix" = "yes" ; 
  185. then
  186.   EOBJ="$EOBJ posix.o"; EDFLGS="$EDFLGS -DUSE_POSIX"
  187. fi
  188.  
  189. echo "Posix support: $posix"
  190.  
  191. ####
  192. #### Use STklos support
  193. ####
  194. AC_ARG_ENABLE(stklos,
  195.     [    --enable-stklos        Provide support for STklos], 
  196.     stklos="$enable_stklos",
  197.     stklos="yes")
  198.  
  199. if test "$stklos" = "yes" ; 
  200. then
  201.   if test "$hashtable" != "yes"
  202.   then
  203.     echo "*** Hash table support is required for STklos."
  204.     echo "*** Forcing hash table support building."
  205.     EOBJ="$EOBJ hash.o"; EDFLGS="$EDFLGS -DUSE_HASH"
  206.   fi
  207.   DFLGS="$DFLGS -DUSE_STKLOS"
  208. fi
  209. echo "STklos support: $stklos"
  210.  
  211. ####
  212. #### Use Socket support from David Tolpin (dvd@pizza.msk.su)
  213. ####
  214. AC_ARG_ENABLE(socket, 
  215.     [    --enable-socket        Provide support for sockets],
  216.     socket="$enable_socket",
  217.     socket="yes")
  218.  
  219. if test "$socket" = "yes" 
  220. then
  221.    EOBJ="$EOBJ socket.o"; EDFLGS="$EDFLGS -DUSE_SOCKET"
  222. fi
  223. echo "Socket support: $socket"
  224.  
  225.  
  226. ####
  227. #### Use Regexp support 
  228. ####
  229. AC_ARG_ENABLE(regexp, 
  230.     [    --enable-regexp        Provide support for regular expressions],
  231.     regexpr="$enable_regexpr",
  232.     regexpr="yes")
  233.  
  234. if test "$regexpr" = "yes" 
  235. then 
  236.    EOBJ="$EOBJ sregexp.o"; EDFLGS="$EDFLGS -DUSE_REGEXP"
  237. fi
  238. echo "Regexp support: $regexpr"
  239.  
  240.  
  241. ####
  242. #### Use Process support 
  243. ####
  244. AC_ARG_ENABLE(process, 
  245.     [    --enable-process    Provide support for Unix processes],
  246.     process="$enable_process",
  247.     process="yes")
  248.  
  249. if test "$process" = "yes" 
  250. then
  251.    EOBJ="$EOBJ process.o"; EDFLGS="$EDFLGS -DUSE_PROCESS"
  252. fi
  253. echo "Process support: $process"
  254.  
  255. ####
  256. #### Html support
  257. ####
  258. AC_ARG_ENABLE(html, 
  259.     [    --enable-html        Enable html support],
  260.     html="$enable_html",
  261.     html="yes")
  262.  
  263. if test "$html" = "yes" ; 
  264. then
  265.   EOBJ="$EOBJ html.o"; EDFLGS="$EDFLGS -DUSE_HTML"
  266. fi
  267.  
  268. echo "Html support: $html"
  269.  
  270. ####
  271. #### Pixmap support
  272. ####
  273. AC_ARG_ENABLE(pixmap, 
  274.     [    --enable-pixmap        Enable pixmap images support],
  275.     pixmapimages="$enable_pixmap",
  276.     pixmapimages="yes")
  277.  
  278. if test "$pixmapimages" = "yes" ; 
  279. then
  280.   ETKOBJ="$ETKOBJ pixmap.o"; EDFLGS="$EDFLGS -DUSE_PIXMAP"
  281. fi
  282. echo "Pixmap Images support: $pixmapimages"
  283.  
  284.  
  285. ##############################################################################
  286. ####
  287. #### Dynamic loading
  288. #### 
  289. ##############################################################################
  290. DYNLOAD=""       ; AC_SUBST(DYNLOAD)
  291. EXTRA_OBJ=""     ; AC_SUBST(EXTRA_OBJ)
  292. LIB_DLD=""     ; AC_SUBST(LIB_DLD)
  293. HAVE_DYNLOAD=yes
  294.  
  295. case $OS in
  296.   unkn*)   HAVE_DYNLOAD="no";;
  297.   ULTRIX)  HAVE_DYNLOAD="no";;
  298.   LINUX)   HAVE_DYNLOAD="no";
  299.        # Try to see if this system could be a ELF one
  300.        elf_hint="no"
  301.        for i in /lib/libc.so*
  302.        do
  303.          set `file  $i`
  304.          if test "$2" = "ELF"
  305.          then 
  306.            elf_hint="yes"
  307.            break
  308.          fi
  309.        done 2> /dev/null
  310.  
  311.            AC_ARG_ENABLE(elf,
  312.        [    --enable-elf        Enable Dynamic Loading using ELF (Linux only)],
  313.        dynload_elf="$enable_elf",
  314.        dynload_elf=$elf_hint)
  315.        
  316.            AC_ARG_ENABLE(dld,
  317.        [    --enable-dld        Enable Dynamic Loading using DLD (Linux only)],
  318.        dynload_dld="$enable_dld",
  319.        dynload_dld="no")
  320.        if test "$dynload_elf" = "yes"
  321.        then 
  322.          if test "$dynload_dld" = "yes"
  323.          then
  324.            echo "**** You have set both DLD and ELF support. Rerun configure"
  325.            exit 1
  326.          fi
  327.          OS=LINUX_ELF
  328.          echo "Linux: Using ELF for dynamic loading"
  329.          HAVE_DYNLOAD="yes"
  330.        fi
  331.        if test "$dynload_dld" = "yes"
  332.        then 
  333.          OS=LINUX_DLD
  334.          echo "Linux: Using DLD for dynamic loading"
  335.          HAVE_DYNLOAD="yes"
  336.        fi
  337.        # Set a compilation flag indicating the format used
  338.        DFLGS="$DFLGS -D$OS" ;;
  339.    *)      AC_ARG_ENABLE(dynload, 
  340.         [    --enable-dynload    Enable Dynamic loading],
  341.         dynload="$enable_dynload",
  342.         dynload="yes")
  343.  
  344.        if test "$dynload" = "no"
  345.        then
  346.          echo "======== Don't use dynamic loading ======="; 
  347.          HAVE_DYNLOAD="no";
  348.        fi;;
  349. esac
  350.     
  351.  
  352. SH_CCFLAGS=""; AC_SUBST(SH_CCFLAGS)
  353. SH_LDFLAGS=""; AC_SUBST(SH_LDFLAGS)
  354. SH_LOADER=":"; AC_SUBST(SH_LOADER)
  355. SH_SUFFIX="";  AC_SUBST(SH_SUFFIX)
  356. LIB_MALLOC=""; AC_SUBST(LIB_MALLOC)
  357.  
  358. echo "Determining options for dynamic loading for $OS"
  359. case $OS in 
  360.   SUNOS4) 
  361.      SH_CCFLAGS="-pic"
  362.      SH_LDFLAGS="-assert pure-text -o"
  363.      SH_LOADER="ld"
  364.      SH_SUFFIX='so';;
  365.    SUNOS5)
  366.      SH_CCFLAGS="-K pic"
  367.      SH_LDFLAGS='-G -z text -h'
  368.      SH_LOADER="ld"
  369.      SH_SUFFIX='so';;
  370.    OSF1)
  371.      SH_CCFLAGS="-fpic"
  372.      SH_LDFLAGS="-shared -o"
  373.      SH_LOADER="ld"
  374.      SH_SUFFIX='so' ;;
  375.    NETBSD1) 
  376.      SH_CCFLAGS="-fpic"
  377.      SH_LDFLAGS="-Bshareable -o"
  378.      SH_LOADER="ld"
  379.      SH_SUFFIX='so';;
  380.    HPUX)
  381.      SH_CCFLAGS="+Z"
  382.      SH_LDFLAGS="-b -o"
  383.      SH_LOADER="ld"
  384.      SH_SUFFIX='sl'
  385.      STKLDFLAGS="$STKLDFLAGS -Wl,-E"
  386.      LIB_DLD=-ldld;;
  387.    FREEBSD)
  388.      SH_CCFLAGS="-pic"
  389.      SH_LDFLAGS="-Bshareable -o"
  390.      SH_LOADER="ld"
  391.      LIB_MALLOC="/usr/lib/libgnumalloc.a"
  392.      SH_SUFFIX='so';;
  393.    IRIX5)
  394.      if test "$CC" = "gcc"
  395.      then 
  396.        SH_CCFLAGS="-fpic"
  397.      else
  398.        SH_CCFLAGS="-KPIC"
  399.      fi
  400.      SH_LDFLAGS="-shared -o"
  401.      SH_LOADER="$CC"
  402.      SH_SUFFIX='so' ;;
  403.    LINUX)
  404.      echo "     Linux: no dynamic loading method choosed";;
  405.    LINUX_DLD)
  406.      SH_CCFLAGS=''
  407.      SH_LDFLAGS='-r -o'
  408.      SH_LOADER='ld'
  409.      SH_SUFFIX='so'
  410.      # Define STRIP to true to avoid executables striping when using DLD
  411.      STRIP=true
  412.      # Add the -ldld flag 
  413.      LIB_DLD=-ldld;;
  414.    LINUX_ELF)
  415.      SH_CCFLAGS=''
  416.      SH_LDFLAGS='-shared -o'
  417.      SH_LOADER='ld'
  418.      SH_SUFFIX='so' 
  419.      # Under ELF, use the -rdynamic option at ld phase
  420.      STKLDFLAGS=-rdynamic;;
  421.    *) echo " (I don't know how to make shared libraries for $OS)" ;;
  422. esac
  423.  
  424. #
  425. # Transform -pic in -fpic if using gcc
  426. #
  427. if test ! -z "SH_CCFLAGS" ; then 
  428.   if test "$CC" = "gcc" -a "$SH_CCFLAGS" != "" ; then
  429.     SH_CCFLAGS="-fpic"
  430.   fi
  431. fi
  432.  
  433. if  test "$HAVE_DYNLOAD" = "yes"
  434. then
  435.   for _i_ in $EOBJ $ETKOBJ
  436.   do 
  437.     EXTRA_OBJ="$EXTRA_OBJ `basename $_i_ .o`.$SH_SUFFIX"
  438.   done
  439.   DYNLOAD=-DUSE_DYNLOAD
  440.   EOBJ=""
  441.   ETKOBJ=""
  442.   EDFLGS=""
  443. fi
  444.  
  445. # Set final DFLGS
  446. DFLGS="$DFLGS $EDFLGS"
  447.  
  448. ####
  449. #### Produce the Makefile
  450. ####
  451. echo
  452. AC_OUTPUT(Makefile)
  453.  
  454. ##############################################################################
  455.  
  456. ####
  457. #### Configuring Sub-directories
  458. ####
  459.  
  460. echo "**** Configuring Src directory";
  461. (cd Src; CC=$CC MACH=$MACH /bin/sh ./configure)
  462.  
  463. echo "**** Configuring Extensions directory";
  464. (cd Extensions; CC=$CC MACH=$MACH /bin/sh ./configure)
  465.  
  466. echo "**** Configuring Tcl directory";
  467. (cd Tcl; CC=$CC /bin/sh ./configure)
  468.  
  469. echo "**** Configuring Tk directory";
  470. (cd Tk; CC=$CC /bin/sh ./configure)
  471.  
  472.  
  473. ###
  474. ### Some things to terminate
  475. ###
  476.  
  477.  
  478. # FreeBsd seems to use an old syntax for inclusion in Makefile. Patch
  479. # Makefiles acordingly 
  480.  
  481. case $OS in
  482.    FREEBSD) for i in */Makefile
  483.         do
  484.         sed <$i > X$$X 's%include ../config.make%.include "../config.make"%'
  485.         mv X$$X $i
  486.         done;;
  487.    *)       ;;
  488. esac
  489.  
  490. ###
  491. ### SUMMARY
  492. ###
  493.  
  494. echo " "
  495. echo " "
  496. echo "SUMMARY"
  497. echo "*******"
  498. echo "   Your system is " $OS
  499. echo "   C compiler used:" $CC
  500. echo "   Compilation options:" $STKCFLAGS
  501. echo -n "   Dynamic loading is "
  502. if test "$HAVE_DYNLOAD" = "yes"
  503. then
  504.    echo "enabled"
  505. else 
  506.    echo "disabled"
  507. fi
  508. echo "   You have choosed the following options"
  509. echo "        Multiple precision library:     " $MP
  510. echo "        Hash tables support:            " $hashtable
  511. echo "        Posix support:                  " $posix
  512. echo "        STklos support:                 " $stklos
  513. echo "        Socket support:                 " $socket
  514. echo "        Regexp support:                 " $regexpr
  515. echo "        Process support:                " $process
  516. echo "        Html support:                   " $html
  517. echo "        Pixmap Images support:          " $pixmapimages
  518. echo " "
  519. echo "If this is correct, you can just type 'make' now at your shell prompt."
  520. echo "Otherwise, rerun configure with proper options (see the README file for"
  521. echo "a description of STk configure options.)"
  522. echo " "
  523.  
  524.